/* 
  Copyright (c) SilverLining 2015
  Date:    2016-1-7
  File:    Package.h  
  Description: 

*/

#pragma once

namespace SL
{
	namespace M
	{
		/// <summary>
		/// Represent a modifiable package, which can be updated using the package manager process.
		/// </summary>
		public ref class Package
		{
		public:
			Package();
			~Package();
			!Package();

			/// <summary>
			/// Return the filename used for package metdata, which must appear at the root of a package.
			/// </summary>
			literal String^ MetadataFileName = PACKAGE_METADATA;
			
			/// <summary>
			/// Represent the package metadata.
			/// </summary>
			property GameObject^ Metadata;

			/// <summary>
			/// Represent the files to be added to the given package by path.
			/// </summary>
			property ICollection<KeyValuePair<String^, String^>>^ FilesByPath;

			/// <summary>
			/// Represent the files to be added to the given package by data.
			/// </summary>
			property ICollection<KeyValuePair<String^, array<byte>^>>^ FilesByData;
			
			/// <summary>
			/// Represent the result of attempting to save the package.
			/// </summary>
			property int Result
			{
				/// <summary>
				/// Return the status of attempting to save the package.
				/// </summary>
				/// <returns>An error code, or zero.</returns>
				int get();
			}

		internal:
			void MakePackage();
			void ThrowIfBadResult();

			m::package* _Package;
		};
	}
}